home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb / dist / breakpoint.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-02  |  35.8 KB  |  1,377 lines

  1. /* Everything about breakpoints, for GDB.
  2.    Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. GDB is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GDB is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GDB; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include <stdio.h>
  21. #include "defs.h"
  22. #include "param.h"
  23. #include "symtab.h"
  24. #include "frame.h"
  25.  
  26. /* This is the sequence of bytes we insert for a breakpoint.  */
  27.  
  28. static char break_insn[] = BREAKPOINT;
  29.  
  30. /* States of enablement of breakpoint.
  31.    `temporary' means disable when hit.
  32.    `delete' means delete when hit.  */
  33.  
  34. enum enable { disabled, enabled, temporary, delete};
  35.  
  36. /* Not that the ->silent field is not currently used by any commands
  37.    (though the code is in there if it was to be and set_raw_breakpoint
  38.    does set it to 0).  I implemented it because I thought it would be
  39.    useful for a hack I had to put in; I'm going to leave it in because
  40.    I can see how there might be times when it would indeed be useful */
  41.  
  42. struct breakpoint
  43. {
  44.   struct breakpoint *next;
  45.   /* Number assigned to distinguish breakpoints.  */
  46.   int number;
  47.   /* Address to break at.  */
  48.   CORE_ADDR address;
  49.   /* Line number of this address.  Redundant.  */
  50.   int line_number;
  51.   /* Symtab of file of this address.  Redundant.  */
  52.   struct symtab *symtab;
  53.   /* Zero means disabled; remember the info but don't break here.  */
  54.   enum enable enable;
  55.   /* Non-zero means a silent breakpoint (don't print frame info
  56.      if we stop here). */
  57.   unsigned char silent;
  58.   /* Number of stops at this breakpoint that should
  59.      be continued automatically before really stopping.  */
  60.   int ignore_count;
  61.   /* "Real" contents of byte where breakpoint has been inserted.
  62.      Valid only when breakpoints are in the program.  */
  63.   char shadow_contents[sizeof break_insn];
  64.   /* Nonzero if this breakpoint is now inserted.  */
  65.   char inserted;
  66.   /* Nonzero if this is not the first breakpoint in the list
  67.      for the given address.  */
  68.   char duplicate;
  69.   /* Chain of command lines to execute when this breakpoint is hit.  */
  70.   struct command_line *commands;
  71.   /* Stack depth (address of frame).  If nonzero, break only if fp
  72.      equals this.  */
  73.   FRAME_ADDR frame;
  74.   /* Conditional.  Break only if this expression's value is nonzero.  */
  75.   struct expression *cond;
  76. };
  77.  
  78. #define ALL_BREAKPOINTS(b)  for (b = breakpoint_chain; b; b = b->next)
  79.  
  80. /* Chain of all breakpoints defined.  */
  81.  
  82. struct breakpoint *breakpoint_chain;
  83.  
  84. /* Number of last breakpoint made.  */
  85.  
  86. static int breakpoint_count;
  87.  
  88. /* Default address, symtab and line to put a breakpoint at
  89.    for "break" command with no arg.
  90.    if default_breakpoint_valid is zero, the other three are
  91.    not valid, and "break" with no arg is an error.
  92.  
  93.    This set by print_stack_frame, which calls set_default_breakpoint.  */
  94.  
  95. int default_breakpoint_valid;
  96. CORE_ADDR default_breakpoint_address;
  97. struct symtab *default_breakpoint_symtab;
  98. int default_breakpoint_line;
  99.  
  100. /* Remaining commands (not yet executed)
  101.    of last breakpoint hit.  */
  102.  
  103. struct command_line *breakpoint_commands;
  104.  
  105. static void delete_breakpoint ();
  106. void clear_momentary_breakpoints ();
  107. void breakpoint_auto_delete ();
  108.  
  109. /* Flag indicating extra verbosity for xgdb.  */
  110. extern int xgdb_verbose;
  111.  
  112. /* condition N EXP -- set break condition of breakpoint N to EXP.  */
  113.  
  114. static void
  115. condition_command (arg, from_tty)
  116.      char *arg;
  117.      int from_tty;
  118. {
  119.   register struct breakpoint *b;
  120.   register char *p;
  121.   register int bnum;
  122.   register struct expression *expr;
  123.  
  124.   if (arg == 0)
  125.     error_no_arg ("breakpoint number");
  126.  
  127.   p = arg;
  128.   while (*p >= '0' && *p <= '9') p++;
  129.   if (p == arg)
  130.     /* There is no number here.  (e.g. "cond a == b").  */
  131.     error_no_arg ("breakpoint number");
  132.   bnum = atoi (arg);
  133.  
  134.   ALL_BREAKPOINTS (b)
  135.     if (b->number == bnum)
  136.       {
  137.     if (b->cond)
  138.       free (b->cond);
  139.     if (*p == 0)
  140.       {
  141.         b->cond = 0;
  142.         if (from_tty)
  143.           printf ("Breakpoint %d now unconditional.\n", bnum);
  144.       }
  145.     else
  146.       {
  147.         if (*p != ' ' && *p != '\t')
  148.           error ("Arguments must be an integer (breakpoint number) and an expression.");
  149.  
  150.         /* Find start of expression */
  151.         while (*p == ' ' || *p == '\t') p++;
  152.  
  153.         arg = p;
  154.         b->cond = (struct expression *) parse_c_1 (&arg, block_for_pc (b->address), 0);
  155.         if (*arg)
  156.           error ("Junk at end of expression");
  157.       }
  158.     return;
  159.       }
  160.  
  161.   error ("No breakpoint number %d.", bnum);
  162. }
  163.  
  164. static void
  165. commands_command (arg)
  166.      char *arg;
  167. {
  168.   register struct breakpoint *b;
  169.   register char *p, *p1;
  170.   register int bnum;
  171.   struct command_line *l;
  172.  
  173.   /* If we allowed this, we would have problems with when to
  174.      free the storage, if we change the commands currently
  175.      being read from.  */
  176.  
  177.   if (breakpoint_commands)
  178.     error ("Can't use the \"commands\" command among a breakpoint's commands.");
  179.  
  180.   /* Allow commands by itself to refer to the last breakpoint.  */
  181.   if (arg == 0)
  182.     bnum = breakpoint_count;
  183.   else
  184.     {
  185.       p = arg;
  186.       if (! (*p >= '0' && *p <= '9'))
  187.     error ("Argument must be integer (a breakpoint number).");
  188.       
  189.       while (*p >= '0' && *p <= '9') p++;
  190.       if (*p)
  191.     error ("Unexpected extra arguments following breakpoint number.");
  192.       
  193.       bnum = atoi (arg);
  194.     }
  195.  
  196.   ALL_BREAKPOINTS (b)
  197.     if (b->number == bnum)
  198.       {
  199.     if (input_from_terminal_p ())
  200.       {
  201.         printf ("Type commands for when breakpoint %d is hit, one per line.\n\
  202. End with a line saying just \"end\".\n", bnum);
  203.         fflush (stdout);
  204.       }
  205.     l = read_command_lines ();
  206.     free_command_lines (&b->commands);
  207.     b->commands = l;
  208.     return;
  209.       }
  210.   error ("No breakpoint number %d.", bnum);
  211. }
  212.  
  213. /* Called from command loop to execute the commands
  214.    associated with the breakpoint we just stopped at.  */
  215.  
  216. void
  217. do_breakpoint_commands ()
  218. {
  219.   while (breakpoint_commands)
  220.     {
  221.       char *line = breakpoint_commands->line;
  222.       breakpoint_commands = breakpoint_commands->next;
  223.       execute_command (line, 0);
  224.       /* If command was "cont", breakpoint_commands is now 0,
  225.      of if we stopped at yet another breakpoint which has commands,
  226.      it is now the commands for the new breakpoint.  */
  227.     }
  228.   clear_momentary_breakpoints ();
  229. }
  230.  
  231. /* Used when the program is proceeded, to eliminate any remaining
  232.    commands attached to the previous breakpoint we stopped at.  */
  233.  
  234. void
  235. clear_breakpoint_commands ()
  236. {
  237.   breakpoint_commands = 0;
  238.   breakpoint_auto_delete (0);
  239. }
  240.  
  241. /* Functions to get and set the current list of pending
  242.    breakpoint commands.  These are used by run_stack_dummy
  243.    to preserve the commands around a function call.  */
  244.  
  245. struct command_line *
  246. get_breakpoint_commands ()
  247. {
  248.   return breakpoint_commands;
  249. }
  250.  
  251. void
  252. set_breakpoint_commands (cmds)
  253.      struct command_line *cmds;
  254. {
  255.   breakpoint_commands = cmds;
  256. }
  257.  
  258. /* insert_breakpoints is used when starting or continuing the program.
  259.    remove_breakpoints is used when the program stops.
  260.    Both return zero if successful,
  261.    or an `errno' value if could not write the inferior.  */
  262.  
  263. int
  264. insert_breakpoints ()
  265. {
  266.   register struct breakpoint *b;
  267.   int val;
  268.  
  269. #ifdef BREAKPOINT_DEBUG
  270.   printf ("Inserting breakpoints.\n");
  271. #endif /* BREAKPOINT_DEBUG */
  272.  
  273.   ALL_BREAKPOINTS (b)
  274.     if (b->enable != disabled && ! b->inserted && ! b->duplicate)
  275.       {
  276.     read_memory (b->address, b->shadow_contents, sizeof break_insn);
  277.     val = write_memory (b->address, break_insn, sizeof break_insn);
  278.     if (val)
  279.       return val;
  280. #ifdef BREAKPOINT_DEBUG
  281.     printf ("Inserted breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
  282.         b->address, b->shadow_contents[0], b->shadow_contents[1]);
  283. #endif /* BREAKPOINT_DEBUG */
  284.     b->inserted = 1;
  285.       }
  286.   return 0;
  287. }
  288.  
  289. int
  290. remove_breakpoints ()
  291. {
  292.   register struct breakpoint *b;
  293.   int val;
  294.  
  295. #ifdef BREAKPOINT_DEBUG
  296.   printf ("Removing breakpoints.\n");
  297. #endif /* BREAKPOINT_DEBUG */
  298.  
  299.   ALL_BREAKPOINTS (b)
  300.     if (b->inserted)
  301.       {
  302.     val = write_memory (b->address, b->shadow_contents, sizeof break_insn);
  303.     if (val)
  304.       return val;
  305.     b->inserted = 0;
  306. #ifdef BREAKPOINT_DEBUG
  307.     printf ("Removed breakpoint at 0x%x, shadow 0x%x, 0x%x.\n",
  308.         b->address, b->shadow_contents[0], b->shadow_contents[1]);
  309. #endif /* BREAKPOINT_DEBUG */
  310.       }
  311.  
  312.   return 0;
  313. }
  314.  
  315. /* Clear the "inserted" flag in all breakpoints.
  316.    This is done when the inferior is loaded.  */
  317.  
  318. void
  319. mark_breakpoints_out ()
  320. {
  321.   register struct breakpoint *b;
  322.  
  323.   ALL_BREAKPOINTS (b)
  324.     b->inserted = 0;
  325. }
  326.  
  327. /* breakpoint_here_p (PC) returns 1 if an enabled breakpoint exists at PC.
  328.    When continuing from a location with a breakpoint,
  329.    we actually single step once before calling insert_breakpoints.  */
  330.  
  331. int
  332. breakpoint_here_p (pc)
  333.      CORE_ADDR pc;
  334. {
  335.   register struct breakpoint *b;
  336.  
  337.   ALL_BREAKPOINTS (b)
  338.     if (b->enable != disabled && b->address == pc)
  339.       return 1;
  340.  
  341.   return 0;
  342. }
  343.  
  344. /* Evaluate the expression EXP and return 1 if value is zero.
  345.    This is used inside a catch_errors to evaluate the breakpoint condition.  */
  346.  
  347. int
  348. breakpoint_cond_eval (exp)
  349.      struct expression *exp;
  350. {
  351.   return value_zerop (evaluate_expression (exp));
  352. }
  353.  
  354. /* Return 0 if PC is not the address just after a breakpoint,
  355.    or -1 if breakpoint says do not stop now,
  356.    or -2 if breakpoint says it has deleted itself and don't stop,
  357.    or -3 if hit a breakpoint number -3 (delete when program stops),
  358.    or else the number of the breakpoint,
  359.    with 0x1000000 added (or subtracted, for a negative return value) for
  360.    a silent breakpoint.  */
  361.  
  362. int
  363. breakpoint_stop_status (pc, frame_address)
  364.      CORE_ADDR pc;
  365.      FRAME_ADDR frame_address;
  366. {
  367.   register struct breakpoint *b;
  368.   register int cont = 0;
  369.  
  370.   /* Get the address where the breakpoint would have been.  */
  371.   pc -= DECR_PC_AFTER_BREAK;
  372.  
  373.   ALL_BREAKPOINTS (b)
  374.     if (b->enable != disabled && b->address == pc)
  375.       {
  376.     if (b->frame && b->frame != frame_address)
  377.       cont = -1;
  378.     else
  379.       {
  380.         int value_zero;
  381.         if (b->cond)
  382.           {
  383.         /* Need to select the frame, with all that implies
  384.            so that the conditions will have the right context.  */
  385.         select_frame (get_current_frame (), 0);
  386.         value_zero
  387.           = catch_errors (breakpoint_cond_eval, b->cond,
  388.                   "Error occurred in testing breakpoint condition.");
  389.         free_all_values ();
  390.           }
  391.         if (b->cond && value_zero)
  392.           {
  393.         cont = -1;
  394.           }
  395.         else if (b->ignore_count > 0)
  396.           {
  397.         b->ignore_count--;
  398.         cont = -1;
  399.           }
  400.         else
  401.           {
  402.         if (b->enable == temporary)
  403.           b->enable = disabled;
  404.         breakpoint_commands = b->commands;
  405.         if (b->silent
  406.             || (breakpoint_commands
  407.             && !strcmp ("silent", breakpoint_commands->line)))
  408.           {
  409.             if (breakpoint_commands)
  410.               breakpoint_commands = breakpoint_commands->next;
  411.             return (b->number > 0 ?
  412.                 0x1000000 + b->number :
  413.                 b->number - 0x1000000);
  414.           }
  415.         return b->number;
  416.           }
  417.       }
  418.       }
  419.  
  420.   return cont;
  421. }
  422.  
  423. static void
  424. breakpoint_1 (bnum)
  425.      int bnum;
  426. {
  427.   register struct breakpoint *b;
  428.   register struct command_line *l;
  429.   register struct symbol *sym;
  430.   CORE_ADDR last_addr = (CORE_ADDR)-1;
  431.  
  432.   ALL_BREAKPOINTS (b)
  433.     if (bnum == -1 || bnum == b->number)
  434.       {
  435.     printf_filtered ("#%-3d %c  0x%08x ", b->number,
  436.         "nyod"[(int) b->enable],
  437.         b->address);
  438.     last_addr = b->address;
  439.     if (b->symtab)
  440.       {
  441.         sym = find_pc_function (b->address);
  442.         if (sym)
  443.           printf_filtered (" in %.100s (%.100s line %d)",
  444.                    SYMBOL_NAME (sym),
  445.                    b->symtab->filename, b->line_number);
  446.         else
  447.           printf_filtered ("%.100s line %d", b->symtab->filename, b->line_number);
  448.       }
  449.     else
  450.       {
  451.         char *name;
  452.         int addr;
  453.  
  454.         if (find_pc_partial_function (b->address, &name, &addr))
  455.           {
  456.         if (b->address - addr)
  457.           printf_filtered ("<%.200s+%d>", name, b->address - addr);
  458.         else
  459.           printf_filtered ("<%.200s>", name);
  460.           }
  461.       }
  462.           
  463.     printf_filtered ("\n");
  464.  
  465.     if (b->ignore_count)
  466.       printf_filtered ("\tignore next %d hits\n", b->ignore_count);
  467.     if (b->frame)
  468.       printf_filtered ("\tstop only in stack frame at 0x%x\n", b->frame);
  469.     if (b->cond)
  470.       {
  471.         printf_filtered ("\tbreak only if ");
  472.         print_expression (b->cond, stdout);
  473.         printf_filtered ("\n");
  474.       }
  475.     if (l = b->commands)
  476.       while (l)
  477.         {
  478.           fputs_filtered (stdout, "\t");
  479.           fputs_filtered (stdout, l->line);
  480.           fputs_filtered (stdout, "\n");
  481.           l = l->next;
  482.         }
  483.       }
  484.  
  485.   /* Compare against (CORE_ADDR)-1 in case some compiler decides
  486.      that a comparison of an unsigned with -1 is always false.  */
  487.   if (last_addr != (CORE_ADDR)-1)
  488.     set_next_address (last_addr);
  489. }
  490.  
  491. static void
  492. breakpoints_info (bnum_exp)
  493.      char *bnum_exp;
  494. {
  495.   int bnum = -1;
  496.  
  497.   if (bnum_exp)
  498.     bnum = parse_and_eval_address (bnum_exp);
  499.   else if (breakpoint_chain == 0)
  500.     printf_filtered ("No breakpoints.\n");
  501.   else
  502.     printf_filtered ("Breakpoints:\n\
  503. Num Enb   Address    Where\n");
  504.  
  505.   breakpoint_1 (bnum);
  506. }
  507.  
  508. /* Print a message describing any breakpoints set at PC.  */
  509.  
  510. static void
  511. describe_other_breakpoints (pc)
  512.      register CORE_ADDR pc;
  513. {
  514.   register int others = 0;
  515.   register struct breakpoint *b;
  516.  
  517.   ALL_BREAKPOINTS (b)
  518.     if (b->address == pc)
  519.       others++;
  520.   if (others > 0)
  521.     {
  522.       printf ("Note: breakpoint%s ", (others > 1) ? "s" : "");
  523.       ALL_BREAKPOINTS (b)
  524.     if (b->address == pc)
  525.       {
  526.         others--;
  527.         printf ("%d%s%s ",
  528.             b->number,
  529.             (b->enable == disabled) ? " (disabled)" : "",
  530.             (others > 1) ? "," : ((others == 1) ? " and" : ""));
  531.       }
  532.       printf ("also set at pc 0x%x.\n", pc);
  533.     }
  534. }
  535.  
  536. /* Set the default place to put a breakpoint
  537.    for the `break' command with no arguments.  */
  538.  
  539. void
  540. set_default_breakpoint (valid, addr, symtab, line)
  541.      int valid;
  542.      CORE_ADDR addr;
  543.      struct symtab *symtab;
  544.      int line;
  545. {
  546.   default_breakpoint_valid = valid;
  547.   default_breakpoint_address = addr;
  548.   default_breakpoint_symtab = symtab;
  549.   default_breakpoint_line = line;
  550. }
  551.  
  552. /* Rescan breakpoints at address ADDRESS,
  553.    marking the first one as "first" and any others as "duplicates".
  554.    This is so that the bpt instruction is only inserted once.  */
  555.  
  556. static void
  557. check_duplicates (address)
  558.      CORE_ADDR address;
  559. {
  560.   register struct breakpoint *b;
  561.   register int count = 0;
  562.  
  563.   ALL_BREAKPOINTS (b)
  564.     if (b->enable != disabled && b->address == address)
  565.       {
  566.     count++;
  567.     b->duplicate = count > 1;
  568.       }
  569. }
  570.  
  571. /* Low level routine to set a breakpoint.
  572.    Takes as args the three things that every breakpoint must have.
  573.    Returns the breakpoint object so caller can set other things.
  574.    Does not set the breakpoint number!
  575.    Does not print anything.  */
  576.  
  577. static struct breakpoint *
  578. set_raw_breakpoint (sal)
  579.      struct symtab_and_line sal;
  580. {
  581.   register struct breakpoint *b, *b1;
  582.  
  583.   b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
  584.   bzero (b, sizeof *b);
  585.   b->address = sal.pc;
  586.   b->symtab = sal.symtab;
  587.   b->line_number = sal.line;
  588.   b->enable = enabled;
  589.   b->next = 0;
  590.   b->silent = 0;
  591.  
  592.   /* Add this breakpoint to the end of the chain
  593.      so that a list of breakpoints will come out in order
  594.      of increasing numbers.  */
  595.  
  596.   b1 = breakpoint_chain;
  597.   if (b1 == 0)
  598.     breakpoint_chain = b;
  599.   else
  600.     {
  601.       while (b1->next)
  602.     b1 = b1->next;
  603.       b1->next = b;
  604.     }
  605.  
  606.   check_duplicates (sal.pc);
  607.  
  608.   return b;
  609. }
  610.  
  611. /* Set a breakpoint that will evaporate an end of command
  612.    at address specified by SAL.
  613.    Restrict it to frame FRAME if FRAME is nonzero.  */
  614.  
  615. void
  616. set_momentary_breakpoint (sal, frame)
  617.      struct symtab_and_line sal;
  618.      FRAME frame;
  619. {
  620.   register struct breakpoint *b;
  621.   b = set_raw_breakpoint (sal);
  622.   b->number = -3;
  623.   b->enable = delete;
  624.   b->frame = (frame ? FRAME_FP (frame) : 0);
  625. }
  626.  
  627. void
  628. clear_momentary_breakpoints ()
  629. {
  630.   register struct breakpoint *b;
  631.   ALL_BREAKPOINTS (b)
  632.     if (b->number == -3)
  633.       {
  634.     delete_breakpoint (b);
  635.     break;
  636.       }
  637. }
  638.  
  639. /* Set a breakpoint from a symtab and line.
  640.    If TEMPFLAG is nonzero, it is a temporary breakpoint.
  641.    Print the same confirmation messages that the breakpoint command prints.  */
  642.  
  643. void
  644. set_breakpoint (s, line, tempflag)
  645.      struct symtab *s;
  646.      int line;
  647.      int tempflag;
  648. {
  649.   register struct breakpoint *b;
  650.   struct symtab_and_line sal;
  651.   
  652.   sal.symtab = s;
  653.   sal.line = line;
  654.   sal.pc = find_line_pc (sal.symtab, sal.line);
  655.   if (sal.pc == 0)
  656.     error ("No line %d in file \"%s\".\n", sal.line, sal.symtab->filename);
  657.   else
  658.     {
  659.       describe_other_breakpoints (sal.pc);
  660.  
  661.       b = set_raw_breakpoint (sal);
  662.       b->number = ++breakpoint_count;
  663.       b->cond = 0;
  664.       if (tempflag)
  665.     b->enable = temporary;
  666.  
  667.       printf ("Breakpoint %d at 0x%x", b->number, b->address);
  668.       if (b->symtab)
  669.     printf (": file %s, line %d.", b->symtab->filename, b->line_number);
  670.       printf ("\n");
  671.     }
  672. }
  673.  
  674. /* Set a breakpoint according to ARG (function, linenum or *address)
  675.    and make it temporary if TEMPFLAG is nonzero. */
  676.  
  677. static void
  678. break_command_1 (arg, tempflag, from_tty)
  679.      char *arg;
  680.      int tempflag, from_tty;
  681. {
  682.   struct symtabs_and_lines sals;
  683.   struct symtab_and_line sal;
  684.   register struct expression *cond = 0;
  685.   register struct breakpoint *b;
  686.   char *save_arg;
  687.   int i;
  688.   CORE_ADDR pc;
  689.  
  690.   sals.sals = NULL;
  691.   sals.nelts = 0;
  692.  
  693.   sal.line = sal.pc = sal.end = 0;
  694.   sal.symtab = 0;
  695.  
  696.   /* If no arg given, or if first arg is 'if ', use the default breakpoint. */
  697.  
  698.   if (!arg || (arg[0] == 'i' && arg[1] == 'f' 
  699.            && (arg[2] == ' ' || arg[2] == '\t')))
  700.     {
  701.       if (default_breakpoint_valid)
  702.     {
  703.       sals.sals = (struct symtab_and_line *) 
  704.         malloc (sizeof (struct symtab_and_line));
  705.       sal.pc = default_breakpoint_address;
  706.       sal.line = default_breakpoint_line;
  707.       sal.symtab = default_breakpoint_symtab;
  708.       sals.sals[0] = sal;
  709.       sals.nelts = 1;
  710.     }
  711.       else
  712.     error ("No default breakpoint address now.");
  713.     }
  714.   else
  715.     /* Force almost all breakpoints to be in terms of the
  716.        current_source_symtab (which is decode_line_1's default).  This
  717.        should produce the results we want almost all of the time while
  718.        leaving default_breakpoint_* alone.  */
  719.     if (default_breakpoint_valid
  720.     && (!current_source_symtab
  721.         || (arg && (*arg == '+' || *arg == '-'))))
  722.       sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
  723.                 default_breakpoint_line);
  724.     else
  725.       sals = decode_line_1 (&arg, 1, 0, 0);
  726.   
  727.   if (! sals.nelts) 
  728.     return;
  729.  
  730.   save_arg = arg;
  731.   for (i = 0; i < sals.nelts; i++)
  732.     {
  733.       sal = sals.sals[i];
  734.       if (sal.pc == 0 && sal.symtab != 0)
  735.     {
  736.       pc = find_line_pc (sal.symtab, sal.line);
  737.       if (pc == 0)
  738.         error ("No line %d in file \"%s\".",
  739.            sal.line, sal.symtab->filename);
  740.     }
  741.       else 
  742.     pc = sal.pc;
  743.       
  744.       while (arg && *arg)
  745.     {
  746.       if (arg[0] == 'i' && arg[1] == 'f'
  747.           && (arg[2] == ' ' || arg[2] == '\t'))
  748.         cond = (struct expression *) parse_c_1 ((arg += 2, &arg),
  749.                             block_for_pc (pc), 0);
  750.       else
  751.         error ("Junk at end of arguments.");
  752.     }
  753.       arg = save_arg;
  754.       sals.sals[i].pc = pc;
  755.     }
  756.  
  757.   for (i = 0; i < sals.nelts; i++)
  758.     {
  759.       sal = sals.sals[i];
  760.  
  761.       if (from_tty)
  762.     describe_other_breakpoints (sal.pc);
  763.  
  764.       b = set_raw_breakpoint (sal);
  765.       b->number = ++breakpoint_count;
  766.       b->cond = cond;
  767.       if (tempflag)
  768.     b->enable = temporary;
  769.  
  770.       printf ("Breakpoint %d at 0x%x", b->number, b->address);
  771.       if (b->symtab)
  772.     printf (": file %s, line %d.", b->symtab->filename, b->line_number);
  773.       printf ("\n");
  774.     }
  775.  
  776.   if (sals.nelts > 1)
  777.     {
  778.       printf ("Multiple breakpoints were set.\n");
  779.       printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
  780.     }
  781.   free (sals.sals);
  782. }
  783.  
  784. static void
  785. break_command (arg, from_tty)
  786.      char *arg;
  787.      int from_tty;
  788. {
  789.   break_command_1 (arg, 0, from_tty);
  790. }
  791.  
  792. static void
  793. tbreak_command (arg, from_tty)
  794.      char *arg;
  795.      int from_tty;
  796. {
  797.   break_command_1 (arg, 1, from_tty);
  798. }
  799.  
  800. /*
  801.  * Helper routine for the until_command routine in infcmd.c.  Here
  802.  * because it uses the mechanisms of breakpoints.
  803.  */
  804. void
  805. until_break_command (arg, from_tty)
  806.      char *arg;
  807.      int from_tty;
  808. {
  809.   struct symtabs_and_lines sals;
  810.   struct symtab_and_line sal;
  811.   FRAME prev_frame = get_prev_frame (selected_frame);
  812.  
  813.   clear_proceed_status ();
  814.  
  815.   /* Set a breakpoint where the user wants it and at return from
  816.      this function */
  817.   
  818.   if (default_breakpoint_valid)
  819.     sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
  820.               default_breakpoint_line);
  821.   else
  822.     sals = decode_line_1 (&arg, 1, 0, 0);
  823.   
  824.   if (sals.nelts != 1)
  825.     error ("Couldn't get information on specified line.");
  826.   
  827.   sal = sals.sals[0];
  828.   free (sals.sals);        /* malloc'd, so freed */
  829.   
  830.   if (*arg)
  831.     error ("Junk at end of arguments.");
  832.   
  833.   if (sal.pc == 0 && sal.symtab != 0)
  834.     sal.pc = find_line_pc (sal.symtab, sal.line);
  835.   
  836.   if (sal.pc == 0)
  837.     error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
  838.   
  839.   set_momentary_breakpoint (sal, selected_frame);
  840.   
  841.   /* Keep within the current frame */
  842.   
  843.   if (prev_frame)
  844.     {
  845.       struct frame_info *fi;
  846.       
  847.       fi = get_frame_info (prev_frame);
  848.       sal = find_pc_line (fi->pc, 0);
  849.       sal.pc = fi->pc;
  850.       set_momentary_breakpoint (sal, prev_frame);
  851.     }
  852.   
  853.   proceed (-1, -1, 0);
  854. }
  855.  
  856. static void
  857. clear_command (arg, from_tty)
  858.      char *arg;
  859.      int from_tty;
  860. {
  861.   register struct breakpoint *b, *b1;
  862.   struct symtabs_and_lines sals;
  863.   struct symtab_and_line sal;
  864.   register struct breakpoint *found;
  865.   int i;
  866.  
  867.   if (arg)
  868.     {
  869.       sals = decode_line_spec (arg, 1);
  870.     }
  871.   else
  872.     {
  873.       sals.sals = (struct symtab_and_line *) malloc (sizeof (struct symtab_and_line));
  874.       sal.line = default_breakpoint_line;
  875.       sal.symtab = default_breakpoint_symtab;
  876.       sal.pc = 0;
  877.       if (sal.symtab == 0)
  878.     error ("No source file specified.");
  879.  
  880.       sals.sals[0] = sal;
  881.       sals.nelts = 1;
  882.     }
  883.  
  884.   for (i = 0; i < sals.nelts; i++)
  885.     {
  886.       /* If exact pc given, clear bpts at that pc.
  887.      But if sal.pc is zero, clear all bpts on specified line.  */
  888.       sal = sals.sals[i];
  889.       found = (struct breakpoint *) 0;
  890.       while (breakpoint_chain
  891.          && (sal.pc ? breakpoint_chain->address == sal.pc
  892.          : (breakpoint_chain->symtab == sal.symtab
  893.             && breakpoint_chain->line_number == sal.line)))
  894.     {
  895.       b1 = breakpoint_chain;
  896.       breakpoint_chain = b1->next;
  897.       b1->next = found;
  898.       found = b1;
  899.     }
  900.  
  901.       ALL_BREAKPOINTS (b)
  902.     while (b->next
  903.            && (sal.pc ? b->next->address == sal.pc
  904.            : (b->next->symtab == sal.symtab
  905.               && b->next->line_number == sal.line)))
  906.       {
  907.         b1 = b->next;
  908.         b->next = b1->next;
  909.         b1->next = found;
  910.         found = b1;
  911.       }
  912.  
  913.       if (found == 0)
  914.     error ("No breakpoint at %s.", arg);
  915.  
  916.       if (found->next) from_tty = 1; /* Always report if deleted more than one */
  917.       if (from_tty) printf ("Deleted breakpoint%s ", found->next ? "s" : "");
  918.       while (found)
  919.     {
  920.       if (from_tty) printf ("%d ", found->number);
  921.       b1 = found->next;
  922.       delete_breakpoint (found);
  923.       found = b1;
  924.     }
  925.       if (from_tty) putchar ('\n');
  926.     }
  927.   free (sals.sals);
  928. }
  929.  
  930. /* Delete breakpoint number BNUM if it is a `delete' breakpoint.
  931.    This is called after breakpoint BNUM has been hit.
  932.    Also delete any breakpoint numbered -3 unless there are breakpoint
  933.    commands to be executed.  */
  934.  
  935. void
  936. breakpoint_auto_delete (bnum)
  937.      int bnum;
  938. {
  939.   register struct breakpoint *b;
  940.   if (bnum != 0)
  941.     ALL_BREAKPOINTS (b)
  942.       if (b->number == bnum)
  943.     {
  944.       if (b->enable == delete)
  945.         delete_breakpoint (b);
  946.       break;
  947.     }
  948.   if (breakpoint_commands == 0)
  949.     clear_momentary_breakpoints ();
  950. }
  951.  
  952. static void
  953. delete_breakpoint (bpt)
  954.      struct breakpoint *bpt;
  955. {
  956.   register struct breakpoint *b;
  957.  
  958.   if (bpt->inserted)
  959.     write_memory (bpt->address, bpt->shadow_contents, sizeof break_insn);
  960.  
  961.   if (breakpoint_chain == bpt)
  962.     breakpoint_chain = bpt->next;
  963.  
  964.   ALL_BREAKPOINTS (b)
  965.     if (b->next == bpt)
  966.       {
  967.     b->next = bpt->next;
  968.     break;
  969.       }
  970.  
  971.   check_duplicates (bpt->address);
  972.  
  973.   free_command_lines (&bpt->commands);
  974.   if (bpt->cond)
  975.     free (bpt->cond);
  976.  
  977.   if (xgdb_verbose && bpt->number >=0)
  978.     printf ("breakpoint #%d deleted\n", bpt->number);
  979.  
  980.   free (bpt);
  981. }
  982.  
  983. static void map_breakpoint_numbers ();
  984.  
  985. static void
  986. delete_command (arg, from_tty)
  987.      char *arg;
  988.      int from_tty;
  989. {
  990.   register struct breakpoint *b, *b1;
  991.  
  992.   if (arg == 0)
  993.     {
  994.       /* Ask user only if there are some breakpoints to delete.  */
  995.       if (!from_tty
  996.       || breakpoint_chain && query ("Delete all breakpoints? "))
  997.     {
  998.       /* No arg; clear all breakpoints.  */
  999.       while (breakpoint_chain)
  1000.         delete_breakpoint (breakpoint_chain);
  1001.     }
  1002.     }
  1003.   else
  1004.     map_breakpoint_numbers (arg, delete_breakpoint);
  1005. }
  1006.  
  1007. /* Delete all breakpoints.
  1008.    Done when new symtabs are loaded, since the break condition expressions
  1009.    may become invalid, and the breakpoints are probably wrong anyway.  */
  1010.  
  1011. void
  1012. clear_breakpoints ()
  1013. {
  1014.   delete_command (0, 0);
  1015. }
  1016.  
  1017. /* Set ignore-count of breakpoint number BPTNUM to COUNT.
  1018.    If from_tty is nonzero, it prints a message to that effect,
  1019.    which ends with a period (no newline).  */
  1020.  
  1021. void
  1022. set_ignore_count (bptnum, count, from_tty)
  1023.      int bptnum, count, from_tty;
  1024. {
  1025.   register struct breakpoint *b;
  1026.  
  1027.   if (count < 0)
  1028.     count = 0;
  1029.  
  1030.   ALL_BREAKPOINTS (b)
  1031.     if (b->number == bptnum)
  1032.       {
  1033.     b->ignore_count = count;
  1034.     if (!from_tty)
  1035.       return;
  1036.     else if (count == 0)
  1037.       printf ("Will stop next time breakpoint %d is reached.", bptnum);
  1038.     else if (count == 1)
  1039.       printf ("Will ignore next crossing of breakpoint %d.", bptnum);
  1040.     else
  1041.       printf ("Will ignore next %d crossings of breakpoint %d.",
  1042.           count, bptnum);
  1043.     return;
  1044.       }
  1045.  
  1046.   error ("No breakpoint number %d.", bptnum);
  1047. }
  1048.  
  1049. /* Clear the ignore counts of all breakpoints.  */
  1050. void
  1051. breakpoint_clear_ignore_counts ()
  1052. {
  1053.   struct breakpoint *b;
  1054.  
  1055.   ALL_BREAKPOINTS (b)
  1056.     b->ignore_count = 0;
  1057. }
  1058.  
  1059. /* Command to set ignore-count of breakpoint N to COUNT.  */
  1060.  
  1061. static void
  1062. ignore_command (args, from_tty)
  1063.      char *args;
  1064.      int from_tty;
  1065. {
  1066.   register char *p = args;
  1067.   register int num;
  1068.  
  1069.   if (p == 0)
  1070.     error_no_arg ("a breakpoint number");
  1071.   
  1072.   while (*p >= '0' && *p <= '9') p++;
  1073.   if (*p && *p != ' ' && *p != '\t')
  1074.     error ("First argument must be a breakpoint number.");
  1075.  
  1076.   num = atoi (args);
  1077.  
  1078.   if (*p == 0)
  1079.     error ("Second argument (specified ignore-count) is missing.");
  1080.  
  1081.   set_ignore_count (num, parse_and_eval_address (p), from_tty);
  1082.   printf ("\n");
  1083. }
  1084.  
  1085. /* Call FUNCTION on each of the breakpoints
  1086.    whose numbers are given in ARGS.  */
  1087.  
  1088. static void
  1089. map_breakpoint_numbers (args, function)
  1090.      char *args;
  1091.      void (*function) ();
  1092. {
  1093.   register char *p = args;
  1094.   register char *p1;
  1095.   register int num;
  1096.   register struct breakpoint *b;
  1097.  
  1098.   if (p == 0)
  1099.     error_no_arg ("one or more breakpoint numbers");
  1100.  
  1101.   while (*p)
  1102.     {
  1103.       p1 = p;
  1104.       while (*p1 >= '0' && *p1 <= '9') p1++;
  1105.       if (*p1 && *p1 != ' ' && *p1 != '\t')
  1106.     error ("Arguments must be breakpoint numbers.");
  1107.  
  1108.       num = atoi (p);
  1109.  
  1110.       ALL_BREAKPOINTS (b)
  1111.     if (b->number == num)
  1112.       {
  1113.         function (b);
  1114.         goto win;
  1115.       }
  1116.       printf ("No breakpoint number %d.\n", num);
  1117.     win:
  1118.       p = p1;
  1119.       while (*p == ' ' || *p == '\t') p++;
  1120.     }
  1121. }
  1122.  
  1123. static void
  1124. enable_breakpoint (bpt)
  1125.      struct breakpoint *bpt;
  1126. {
  1127.   bpt->enable = enabled;
  1128.  
  1129.   if (xgdb_verbose && bpt->number >= 0)
  1130.     printf ("breakpoint #%d enabled\n", bpt->number);
  1131.  
  1132.   check_duplicates (bpt->address);
  1133. }
  1134.  
  1135. static void
  1136. enable_command (args)
  1137.      char *args;
  1138. {
  1139.   struct breakpoint *bpt;
  1140.   if (args == 0)
  1141.     ALL_BREAKPOINTS (bpt)
  1142.       enable_breakpoint (bpt);
  1143.   else
  1144.     map_breakpoint_numbers (args, enable_breakpoint);
  1145. }
  1146.  
  1147. static void
  1148. disable_breakpoint (bpt)
  1149.      struct breakpoint *bpt;
  1150. {
  1151.   bpt->enable = disabled;
  1152.  
  1153.   if (xgdb_verbose && bpt->number >= 0)
  1154.     printf ("breakpoint #%d disabled\n", bpt->number);
  1155.  
  1156.   check_duplicates (bpt->address);
  1157. }
  1158.  
  1159. static void
  1160. disable_command (args)
  1161.      char *args;
  1162. {
  1163.   register struct breakpoint *bpt;
  1164.   if (args == 0)
  1165.     ALL_BREAKPOINTS (bpt)
  1166.       disable_breakpoint (bpt);
  1167.   else
  1168.     map_breakpoint_numbers (args, disable_breakpoint);
  1169. }
  1170.  
  1171. static void
  1172. enable_once_breakpoint (bpt)
  1173.      struct breakpoint *bpt;
  1174. {
  1175.   bpt->enable = temporary;
  1176.  
  1177.   check_duplicates (bpt->address);
  1178. }
  1179.  
  1180. static void
  1181. enable_once_command (args)
  1182.      char *args;
  1183. {
  1184.   map_breakpoint_numbers (args, enable_once_breakpoint);
  1185. }
  1186.  
  1187. static void
  1188. enable_delete_breakpoint (bpt)
  1189.      struct breakpoint *bpt;
  1190. {
  1191.   bpt->enable = delete;
  1192.  
  1193.   check_duplicates (bpt->address);
  1194. }
  1195.  
  1196. static void
  1197. enable_delete_command (args)
  1198.      char *args;
  1199. {
  1200.   map_breakpoint_numbers (args, enable_delete_breakpoint);
  1201. }
  1202.  
  1203. /*
  1204.  * Use default_breakpoint_'s, or nothing if they aren't valid.
  1205.  */
  1206. struct symtabs_and_lines
  1207. decode_line_spec_1 (string, funfirstline)
  1208.      char *string;
  1209.      int funfirstline;
  1210. {
  1211.   struct symtabs_and_lines sals;
  1212.   if (string == 0)
  1213.     error ("Empty line specification.");
  1214.   if (default_breakpoint_valid)
  1215.     sals = decode_line_1 (&string, funfirstline,
  1216.               default_breakpoint_symtab, default_breakpoint_line);
  1217.   else
  1218.     sals = decode_line_1 (&string, funfirstline, 0, 0);
  1219.   if (*string)
  1220.     error ("Junk at end of line specification: %s", string);
  1221.   return sals;
  1222. }
  1223.  
  1224.  
  1225. /* Chain containing all defined enable commands.  */
  1226.  
  1227. extern struct cmd_list_element 
  1228.   *enablelist, *disablelist,
  1229.   *deletelist, *enablebreaklist;
  1230.  
  1231. extern struct cmd_list_element *cmdlist;
  1232.  
  1233. void
  1234. _initialize_breakpoint ()
  1235. {
  1236.   breakpoint_chain = 0;
  1237.   breakpoint_count = 0;
  1238.  
  1239.   add_com ("ignore", class_breakpoint, ignore_command,
  1240.        "Set ignore-count of breakpoint number N to COUNT.");
  1241.  
  1242.   add_com ("commands", class_breakpoint, commands_command,
  1243.        "Set commands to be executed when a breakpoint is hit.\n\
  1244. Give breakpoint number as argument after \"commands\".\n\
  1245. With no argument, the targeted breakpoint is the last one set.\n\
  1246. The commands themselves follow starting on the next line.\n\
  1247. Type a line containing \"end\" to indicate the end of them.\n\
  1248. Give \"silent\" as the first line to make the breakpoint silent;\n\
  1249. then no output is printed when it is hit, except what the commands print.");
  1250.  
  1251.   add_com ("condition", class_breakpoint, condition_command,
  1252.        "Specify breakpoint number N to break only if COND is true.\n\
  1253. N is an integer; COND is a C expression to be evaluated whenever\n\
  1254. breakpoint N is reached.  Actually break only when COND is nonzero.");
  1255.  
  1256.   add_com ("tbreak", class_breakpoint, tbreak_command,
  1257.        "Set a temporary breakpoint.  Args like \"break\" command.\n\
  1258. Like \"break\" except the breakpoint is only enabled temporarily,\n\
  1259. so it will be disabled when hit.  Equivalent to \"break\" followed\n\
  1260. by using \"enable once\" on the breakpoint number.");
  1261.  
  1262.   add_prefix_cmd ("enable", class_breakpoint, enable_command,
  1263.           "Enable some breakpoints or auto-display expressions.\n\
  1264. Give breakpoint numbers (separated by spaces) as arguments.\n\
  1265. With no subcommand, breakpoints are enabled until you command otherwise.\n\
  1266. This is used to cancel the effect of the \"disable\" command.\n\
  1267. With a subcommand you can enable temporarily.\n\
  1268. \n\
  1269. The \"display\" subcommand applies to auto-displays instead of breakpoints.",
  1270.           &enablelist, "enable ", 1, &cmdlist);
  1271.  
  1272.   add_abbrev_prefix_cmd ("breakpoints", class_breakpoint, enable_command,
  1273.           "Enable some breakpoints or auto-display expressions.\n\
  1274. Give breakpoint numbers (separated by spaces) as arguments.\n\
  1275. With no subcommand, breakpoints are enabled until you command otherwise.\n\
  1276. This is used to cancel the effect of the \"disable\" command.\n\
  1277. May be abbreviates to simply \"enable\".\n\
  1278. With a subcommand you can enable temporarily.",
  1279.           &enablebreaklist, "enable breakpoints ", 1, &enablelist);
  1280.  
  1281.   add_cmd ("once", no_class, enable_once_command,
  1282.        "Enable breakpoints for one hit.  Give breakpoint numbers.\n\
  1283. If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
  1284. See the \"tbreak\" command which sets a breakpoint and enables it once.",
  1285.        &enablebreaklist);
  1286.  
  1287.   add_cmd ("delete", no_class, enable_delete_command,
  1288.        "Enable breakpoints and delete when hit.  Give breakpoint numbers.\n\
  1289. If a breakpoint is hit while enabled in this fashion, it is deleted.",
  1290.        &enablebreaklist);
  1291.  
  1292.   add_cmd ("delete", no_class, enable_delete_command,
  1293.        "Enable breakpoints and delete when hit.  Give breakpoint numbers.\n\
  1294. If a breakpoint is hit while enabled in this fashion, it is deleted.",
  1295.        &enablelist);
  1296.  
  1297.   add_cmd ("once", no_class, enable_once_command,
  1298.        "Enable breakpoints for one hit.  Give breakpoint numbers.\n\
  1299. If a breakpoint is hit while enabled in this fashion, it becomes disabled.\n\
  1300. See the \"tbreak\" command which sets a breakpoint and enables it once.",
  1301.        &enablelist);
  1302.  
  1303.   add_prefix_cmd ("disable", class_breakpoint, disable_command,
  1304.        "Disable some breakpoints or auto-display expressions.\n\
  1305. Arguments are breakpoint numbers with spaces in between.\n\
  1306. To disable all breakpoints, give no argument.\n\
  1307. A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
  1308. \n\
  1309. The \"display\" subcommand applies to auto-displays instead of breakpoints.",
  1310.           &disablelist, "disable ", 1, &cmdlist);
  1311.   add_com_alias ("dis", "disable", class_breakpoint, 1);
  1312.   add_com_alias ("disa", "disable", class_breakpoint, 1);
  1313.  
  1314.   add_abbrev_cmd ("breakpoints", class_breakpoint, disable_command,
  1315.        "Disable some breakpoints or auto-display expressions.\n\
  1316. Arguments are breakpoint numbers with spaces in between.\n\
  1317. To disable all breakpoints, give no argument.\n\
  1318. A disabled breakpoint is not forgotten, but has no effect until reenabled.\n\
  1319. This command may be abbreviated \"disable\".",
  1320.        &disablelist);
  1321.  
  1322.   add_prefix_cmd ("delete", class_breakpoint, delete_command,
  1323.        "Delete some breakpoints or auto-display expressions.\n\
  1324. Arguments are breakpoint numbers with spaces in between.\n\
  1325. To delete all breakpoints, give no argument.\n\
  1326. \n\
  1327. Also a prefix command for deletion of other GDB objects.\n\
  1328. The \"unset\" command is also an alias for \"delete\".",
  1329.           &deletelist, "delete ", 1, &cmdlist);
  1330.   add_com_alias ("d", "delete", class_breakpoint, 1);
  1331.   add_com_alias ("unset", "delete", class_alias, 1);
  1332.  
  1333.   add_cmd ("breakpoints", class_alias, delete_command,
  1334.        "Delete some breakpoints or auto-display expressions.\n\
  1335. Arguments are breakpoint numbers with spaces in between.\n\
  1336. To delete all breakpoints, give no argument.\n\
  1337. This command may be abbreviated \"delete\".",
  1338.        &deletelist);
  1339.  
  1340.   add_com ("clear", class_breakpoint, clear_command,
  1341.        "Clear breakpoint at specified line or function.\n\
  1342. Argument may be line number, function name, or \"*\" and an address.\n\
  1343. If line number is specified, all breakpoints in that line are cleared.\n\
  1344. If function is specified, breakpoints at beginning of function are cleared.\n\
  1345. If an address is specified, breakpoints at that address are cleared.\n\n\
  1346. With no argument, clears all breakpoints in the line that the selected frame\n\
  1347. is executing in.\n\
  1348. \n\
  1349. See also the \"delete\" command which clears breakpoints by number.");
  1350.  
  1351.   add_com ("break", class_breakpoint, break_command,
  1352.        "Set breakpoint at specified line or function.\n\
  1353. Argument may be line number, function name, or \"*\" and an address.\n\
  1354. If line number is specified, break at start of code for that line.\n\
  1355. If function is specified, break at start of code for that function.\n\
  1356. If an address is specified, break at that exact address.\n\
  1357. With no arg, uses current execution address of selected stack frame.\n\
  1358. This is useful for breaking on return to a stack frame.\n\
  1359. \n\
  1360. Multiple breakpoints at one place are permitted, and useful if conditional.\n\
  1361. \n\
  1362. Do \"help breakpoints\" for info on other commands dealing with breakpoints.");
  1363.   add_com_alias ("b", "break", class_run, 1);
  1364.   add_com_alias ("br", "break", class_run, 1);
  1365.   add_com_alias ("bre", "break", class_run, 1);
  1366.   add_com_alias ("brea", "break", class_run, 1);
  1367.  
  1368.   add_info ("breakpoints", breakpoints_info,
  1369.         "Status of all breakpoints, or breakpoint number NUMBER.\n\
  1370. Second column is \"y\" for enabled breakpoint, \"n\" for disabled,\n\
  1371. \"o\" for enabled once (disable when hit), \"d\" for enable but delete when hit.\n\
  1372. Then come the address and the file/line number.\n\n\
  1373. Convenience variable \"$_\" and default examine address for \"x\"\n\
  1374. are set to the address of the last breakpoint listed.");
  1375. }
  1376.  
  1377.